package com.andy.blog.dal.service.impl;

import com.andy.blog.dal.domain.GenTableColumnDO;
import com.andy.blog.dal.mapper.GenTableColumnMapper;
import com.andy.blog.dal.service.GenTableColumnDalService;
import com.andy.blog.dal.vo.GenTableColumnVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by andy on 2024/6/27 18:57
 **/
@Service
public class GenTableColumnDalServiceImpl implements GenTableColumnDalService {

    @Resource
    private GenTableColumnMapper genTableColumnMapper;


    @Override
    public List<GenTableColumnDO> selectByList(GenTableColumnVO genTableColumnVO) {

        LambdaQueryWrapper<GenTableColumnDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(genTableColumnVO.getTableId()), GenTableColumnDO::getTableId, genTableColumnVO.getTableId())
                .orderByDesc(GenTableColumnDO::getSort);

        return genTableColumnMapper.selectList(lambdaQueryWrapper);
    }
}
